package jnpf.engine.custom.cmd.commons;

import org.flowable.common.engine.impl.interceptor.Command;
import org.flowable.common.engine.impl.interceptor.CommandContext;
import org.flowable.engine.impl.persistence.entity.ExecutionEntity;
import org.flowable.engine.impl.util.CommandContextUtil;

public class GetSecondExecutionEntityVariableCmd implements Command<String> {
    protected String taskExecutionId;
    @Override
    public  String execute(CommandContext commandContext) {
        ExecutionEntity executionEntity = CommandContextUtil.getExecutionEntityManager(commandContext).findById(taskExecutionId);
        ExecutionEntity parent = executionEntity.getParent();
        String branchList = parent.getVariableLocal("branchList",String.class);
        return branchList;
    }

    public GetSecondExecutionEntityVariableCmd(String taskExecutionId) {
        this.taskExecutionId = taskExecutionId;
    }
}
